<!--************************************************************ -->
<!--* 文件创建日期：2010                                  * -->
<!--* 文件修改日期：			                                   * -->
<!--************************************************************ -->
<!--JSP初始化设置-->
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@page import="com.infomanage.po.*" %>
<%@page import="com.infomanage.vo.*" %>
<%@page import="com.infomanage.enums.*"%>
<%@page import="com.infomanage.util.TimeUtil"%>
<%@page import="com.qs.service.*"%>
<%@page import="com.qs.vo.*"%>
<%@page import="com.qs.po.*"%>
<%  response.addDateHeader("Expires", 0);response.setHeader("Pragma","no-cache"); response.setHeader("Cache-Control","no-cache");%>
<%
	request.setCharacterEncoding("UTF-8");
	String itemId = request.getParameter("itemId");
    if(itemId == null) itemId = "";
    
    QsRecAccidentItem item = RecordAccidentService.load(request, response, out);
    String deptName = "";
    String inputerName = "";
    String accidentDeptName = "";
    String accidentDetail = "";
    String accidentExperience = "";
    int accidentPersonNum = 0;
    String accidentPlace = "";
    String accidentProperty = "";
    int actionPersonNum = 0;
    String actionTimeStr = "";
    String actionDay = "";
    String actionHour = "";
    String actionMinute = "";
    String actionTotalTime = "";
    String callTimeStr = "";
    String callDay = "";
    String callHour = "";
    String callMinute = "";
    int deptId = -1;
    String diePersonNames = "";
    int diePersonNum = 0;
    String highTempWorkTime = "";
    String hxqTime = "";
    String injuredPersonNames = "";
    int injuredPersonNum = 0;
    int inputerId = -1;
    String otherContent = "";
    int outDeadbodyNum = 0;
    String rescueCommanderName = "";
    String rescueDirectorName = "";
    String rescueTime = "";
    String restoreRoadwayTime = "";
    String returnTimeStr = "";
    String returnDay = "";
    String returnHour = "";
    String returnMinute = "";
    String saveMoney = "";
    String schematic = "";
    String timestamp = "";
    String treatDeptName = "";
    if(item != null) {
    	QsRecAccident bean = item.getBean();
		Department dept = item.getDept();
		Person inputer = item.getInputer();
		deptName = dept.getPath();
		inputerName = inputer.getName();
		accidentDeptName = bean.getAccidentDeptName();
		accidentDetail = bean.getAccidentDetail();
		accidentExperience = bean.getAccidentExperience();
		accidentPersonNum = bean.getAccidentPersonNum();
		accidentPlace = bean.getAccidentPlace();
		accidentProperty = bean.getAccidentProperty();
		actionPersonNum = bean.getActionPersonNum();
		actionTimeStr = bean.getActionTime();
		actionDay = TimeUtil.toDayTime(actionTimeStr);
		actionHour = TimeUtil.toHourTime(actionTimeStr);
		actionMinute = TimeUtil.toMinuteTime(actionTimeStr);
		actionTotalTime = bean.getActionTotalTime();
		callTimeStr = bean.getCallTime();
		callDay = TimeUtil.toDayTime(callTimeStr);
		callHour = TimeUtil.toHourTime(callTimeStr);
		callMinute = TimeUtil.toMinuteTime(callTimeStr);
		deptId = bean.getDeptId();
		diePersonNames = bean.getDiePersonNames();
		diePersonNum = bean.getDiePersonNum();
		highTempWorkTime = bean.getHighTempWorkTime();
		hxqTime = bean.getHxqTime();
		injuredPersonNames = bean.getInjuredPersonNames();
		injuredPersonNum = bean.getInjuredPersonNum();
		inputerId = bean.getInputerId();
		otherContent = bean.getOtherContent();
		outDeadbodyNum = bean.getOutDeadbodyNum();
		rescueCommanderName = bean.getRescueCommanderName();
		rescueDirectorName = bean.getRescueDirectorName();
		rescueTime = bean.getRescueTime();
		restoreRoadwayTime = bean.getRestoreRoadwayTime();
		returnTimeStr = bean.getReturnTime();
		returnDay = TimeUtil.toDayTime(returnTimeStr);
		returnHour = TimeUtil.toHourTime(returnTimeStr);
		returnMinute = TimeUtil.toMinuteTime(returnTimeStr);
		saveMoney = bean.getSaveMoney();
		schematic = bean.getSchematic();
		timestamp = bean.getTimestamp();
		treatDeptName = bean.getTreatDeptName();
    } 
%>
<html>
<head>
	<title>事故处理记录</title>
	<META HTTP-EQUIV="Pragma" CONTENT="no-cache">	
	<link href="<%=request.getContextPath() %>/css/table.css" rel="stylesheet" type="text/css">
	<link href="<%=request.getContextPath() %>/css/calendar.css" rel="stylesheet" type="text/css">
	<script type="text/javascript" src="<%=request.getContextPath() %>/js/calendar.js"></script>
	<script type="text/javascript" src="<%=request.getContextPath() %>/js/common.js"></script>
	<script type="text/javascript">
	   var legendName="";
	   function init() {
		   if("" != "<%=itemId%>") { // 修改
		   	   document.getElementById("legend").style.display = "none";
		       document.getElementById("uploadLink").style.display = "";
		       legendName = "<%=schematic%>";
		   	   form1.callHour.value = "<%=callHour%>";
		   	   form1.callMinute.value = "<%=callMinute%>";
		   	   form1.returnHour.value = "<%=returnHour%>";
		   	   form1.returnMinute.value = "<%=returnMinute%>";
		   	   form1.actionHour.value = "<%=actionHour%>";
		   	   form1.actionMinute.value = "<%=actionMinute%>";
		   }
	   }
	   // 提交
	   function doSubmit(){
	   		if(validate()){
	   			return;
	   		}
	 		form1.callTime.value = form1.callDay.value + ";" + form1.callHour.value + ";" + form1.callMinute.value;
	 		form1.actionTime.value = form1.actionDay.value + ";" + form1.actionHour.value + ";" + form1.actionMinute.value;
	 		form1.returnTime.value = form1.returnDay.value + ";" + form1.returnHour.value + ";" + form1.returnMinute.value;
		 	if("" == "<%=itemId%>") {
		 		form1.actionType.value = "add";
			}else {
		 		form1.actionType.value = "modify";
			}
		 	form1.submit();
	   }

	   function showError(error){
		   alert(error);
	   }

	   function showInfo(info){
		   alert(info);
		   window.returnValue = "ok";
		   window.close();
	   }
	   
	   function validate(){
	   		if(form1.deptId.value == -1){
	   			alert("填报单位不能为空！");
	   			return true;
	   		}
	   		if(form1.inputerId.value == -1){
	   			alert("填表人不能为空！");
	   			return true;
	   		}
	   		
	   		if(isNaN(form1.accidentPersonNum.value)){
	   			alert("遇险人数必须为数字！");
	   			return true;
	   		}
	   		if(isNaN(form1.diePersonNum.value)){
	   			alert("遇难人数必须为数字！");
	   			return true;
	   		}
	   		if(isNaN(form1.actionPersonNum.value)){
	   			alert("出动人数必须为数字！");
	   			return true;
	   		}
	   		if(isNaN(form1.outDeadbodyNum.value)){
	   			alert("运出尸体数必须为数字！");
	   			return true;
	   		}
	   		if(isNaN(form1.injuredPersonNum.value)){
	   			alert("救出受伤人数必须为数字！");
	   			return true;
	   		}
	   		
	   		if(form1.accidentDeptName.value.length > 3000){
   				alert("事故单位名称不能超过3000个字！");
   				return true;
	   	    }
	   		
	   		if(form1.accidentPlace.value.length > 3000){
   				alert("事故发生地点不能超过3000个字！");
   				return true;
	   	    }
	   		return false;
	   }
	   
	   function uploadLegend(){
	   		var url = "accident_upload.jsp";
			var width = '400px';
			var height ='200px';
			var arg = "dialogHeight:" + height + ";dialogWidth:" + width + ";status:no;location:no;";
			var returnValue = window.showModalDialog(url, "", arg);
			if(returnValue){
				var legend = document.getElementById("legend");
				legendName = returnValue;
				form1.schematic.value = legendName;
				var uploadLink = document.getElementById("uploadLink");
				uploadLink.style.display = "none"
				legend.style.display = "";
			}
	   }
	   
	   function showLegend(pictureDir){
			var url = encodeURI("accident_legend.jsp?pictureDir="+pictureDir);
			var width = '700px';
			var height ='500px';
			var arg = "dialogHeight:" + height + ";dialogWidth:" + width + ";status:no;location:no;edge=sunken;center=yes;resizable=yes;Minimize=yes;Maximize=yes";
			var returnValue = window.showModalDialog(url, "", arg);
			if(returnValue){
				dataFrame.location.reload();
			}
		}
	</script>
</head>
<body  rightmargin="0" bottommargin="0" leftmargin="0" topmargin="0" onclick="clickBody();" onload="init();">
	<form name="form1" action="accident_action.jsp" method="post" target="actionFrame">
	<input type="hidden" name="itemId" value="<%=itemId%>">
	<input type="hidden" name="actionType">
	<input type="hidden" name="callTime">
	<input type="hidden" name="actionTime">
	<input type="hidden" name="returnTime">
	<input type="hidden" name="schematic">
	<table class="dialogTable" cellpadding="0" cellspacing="0">
		<!-- 表头-->
		<tr class="dialogTableHeader">
			<td>事故处理记录</td>
		</tr>
		<!-- 表数据-->
		<tr class="dialogTableContent">
			<td height="100%">
				<div style="height: 100%;width: 100%;overflow: auto;">
				<!-- 数据项 -->
				<table class="dataTable">
					<col width="15%">
					<col width="30%">
					<col width="10%">
					<col width="18%">
					<col width="12%">
					<col width="15%">
					<tr>
						<td class="field">
							填报单位
						</td>
						<td colspan="1">
							<span class="treeSpan" style="width: 240px;" onclick="showTree(this, '<%=request.getContextPath() %>/infomanage/common/deptTree.jsp');" treeSelect="true" treeType="1">
								<input name="deptName" nodeId="" id="deptTreeInput" value="<%=deptName %>" 
									style="width: 223px;" readonly="readonly" 
									treeSelect="true"><input name="deptId" value="<%= deptId%>" type="hidden">
							</span>
						</td>
						<td class="field">
							日期
						</td>
						<td colspan="3">
							<input name="timestamp" value="<%=timestamp %>" type="text" style="width: 230px;cursor: hand;" id="time" onClick="return showCalendar(this.id, 'y-mm-dd');" readonly="readonly"><img 
									src="<%=request.getContextPath() %>/img/tip_calender.gif" style="cursor: hand;" width="16" height="16" onClick="return showCalendar('time', 'y-mm-dd');">
						</td>
					</tr>
					<tr>
						<td class="field">
							事故单位名称
						</td>
						<td colspan="5">
							<input value="<%=accidentDeptName %>" type="text" style="width: 100%;" name="accidentDeptName">
						</td>
					</tr>
					<tr>
						<td class="field">
							事故发生地点
						</td>
						<td>
							<input value="<%=accidentPlace %>" type="text" style="width: 100%;" name="accidentPlace">
						</td>
						<td class="field">
							遇险人员
						</td>
						<td>
							<input value="<%=accidentPersonNum %>" type="text" style="width: 80%;" name="accidentPersonNum">&nbsp;名
						</td>
						<td class="field">
							事故性质
						</td>
						<td>
							<input value="<%=accidentProperty %>" type="text" style="width: 100%;" name="accidentProperty">
						</td>
					</tr>
					<tr>
						<td class="field">
							来电时间
						</td>
						<td>
							<input name="callDay" value="<%=callDay %>" type="text" style="width: 80px;cursor: hand;" id="time1" onClick="return showCalendar(this.id, 'y-mm-dd');" readonly="readonly"><img 
							src="<%=request.getContextPath() %>/img/tip_calender.gif" style="cursor: hand;" width="16" height="16" onClick="return showCalendar('time1', 'y-mm-dd');">
		   							&nbsp;&nbsp;<select name="callHour">
			   							<%
			   								for(int i = 0; i < TimeUtil.get24Hours().length; i++){
			   							%>
			   							<option value="<%=TimeUtil.get24Hours()[i]%>"><%=TimeUtil.get24Hours()[i]%></option>
			   							<%
			   								}
			   							%>
		   							</select>
		   							时
		   							&nbsp;&nbsp;<select name="callMinute">
			   							<%
			   								for(int i = 0; i < TimeUtil.get60Minutes().length; i++){
			   							%>
			   							<option value="<%=TimeUtil.get60Minutes()[i]%>"><%=TimeUtil.get60Minutes()[i]%></option>
			   							<%
			   								}
			   							%>
		   							</select>
		   							分
						</td>
						<td class="field">
							遇难人数
						</td>
						<td>
							<input value="<%=diePersonNum %>" type="text" style="width: 80%;" name="diePersonNum">&nbsp;名
						</td>
						<td class="field">
							招请人单位及姓名
						</td>
						<td>
							<input value="<%=treatDeptName %>" type="text" style="width: 100%;" name="treatDeptName">
						</td>
					</tr>
					<tr>
						<td class="field">
							出动时间
						</td>
						<td>
							<input name="actionDay" value="<%=actionDay %>" type="text" style="width: 80px;cursor: hand;" id="time2" onClick="return showCalendar(this.id, 'y-mm-dd');" readonly="readonly"><img 
							src="<%=request.getContextPath() %>/img/tip_calender.gif" style="cursor: hand;" width="16" height="16" onClick="return showCalendar('time2', 'y-mm-dd');">
		   							&nbsp;&nbsp;<select name="actionHour">
			   							<%
			   								for(int i = 0; i < TimeUtil.get24Hours().length; i++){
			   							%>
			   							<option value="<%=TimeUtil.get24Hours()[i]%>"><%=TimeUtil.get24Hours()[i]%></option>
			   							<%
			   								}
			   							%>
		   							</select>
		   							时
		   							&nbsp;&nbsp;<select name="actionMinute">
			   							<%
			   								for(int i = 0; i < TimeUtil.get60Minutes().length; i++){
			   							%>
			   							<option value="<%=TimeUtil.get60Minutes()[i]%>"><%=TimeUtil.get60Minutes()[i]%></option>
			   							<%
			   								}
			   							%>
		   							</select>
		   							分
						</td>
						<td class="field">
							出动人数
						</td>
						<td>
							<input value="<%=actionPersonNum %>" type="text" style="width: 80%;" name="actionPersonNum">&nbsp;名
						</td>
						<td class="field">
							抢救总指挥
						</td>
						<td>
							<input value="<%=rescueCommanderName %>" type="text" style="width: 100%;" name="rescueCommanderName">
						</td>
					</tr>
					<tr>
						<td class="field">
							返回队部时间
						</td>
						<td>
							<input name="returnDay" value="<%=returnDay %>" type="text" style="width: 80px;cursor: hand;" id="time3" onClick="return showCalendar(this.id, 'y-mm-dd');" readonly="readonly"><img 
							src="<%=request.getContextPath() %>/img/tip_calender.gif" style="cursor: hand;" width="16" height="16" onClick="return showCalendar('time3', 'y-mm-dd');">
		   							&nbsp;&nbsp;<select name="returnHour">
			   							<%
			   								for(int i = 0; i < TimeUtil.get24Hours().length; i++){
			   							%>
			   							<option value="<%=TimeUtil.get24Hours()[i]%>"><%=TimeUtil.get24Hours()[i]%></option>
			   							<%
			   								}
			   							%>
		   							</select>
		   							时
		   							&nbsp;&nbsp;<select name="returnMinute">
			   							<%
			   								for(int i = 0; i < TimeUtil.get60Minutes().length; i++){
			   							%>
			   							<option value="<%=TimeUtil.get60Minutes()[i]%>"><%=TimeUtil.get60Minutes()[i]%></option>
			   							<%
			   								}
			   							%>
		   							</select>
		   							分
						</td>
						<td class="field">
							出动总时间
						</td>
						<td>
							<input value="<%= actionTotalTime%>" type="text" style="width: 80%;" name="actionTotalTime">&nbsp;小时
						</td>
						<td class="field">
							救护队负责人
						</td>
						<td>
							<input value="<%=rescueDirectorName %>" type="text" style="width: 100%;" name="rescueDirectorName">
						</td>
					</tr>
					<tr>
						<td class="field">
							事故现场情况及处理经过
						</td>
						<td height="150px" colspan="5">
							<textarea name="accidentDetail" style="height: 100%;width: 100%;"><%= accidentDetail%></textarea>
						</td>
					</tr>
					<tr>
						<td class="field">
							主要经验与教训
						</td>
						<td height="80px" colspan="5">
							<textarea name="accidentExperience" style="height: 100%;width: 100%;"><%= accidentExperience%></textarea>
						</td>
					</tr>
					<tr>
						<td class="field">
							事故现场示意图
						</td>
						<td height="120px" colspan="5">
							<a id="uploadLink" href="#" onclick="uploadLegend();">上传图片</a>
							<a id="legend"  href="#" onclick="showLegend(legendName);" style="display:none">查看图片</a>
						</td>
					</tr>
					<tr>
						<td class="field">
							抢险救灾
						</td>
						<td>
							<input value="<%=rescueTime %>" type="text" style="width: 80%;" name="rescueTime">&nbsp;小时
						</td>
						<td class="field">
							佩用呼吸器时间
						</td>
						<td>
							<input value="<%=hxqTime %>" type="text" style="width: 80%;" name="hxqTime">&nbsp;小时
						</td>
						<td class="field">
							高温工作时间
						</td>
						<td>
							<input value="<%=highTempWorkTime %>" type="text" style="width: 70%;" name="highTempWorkTime">&nbsp;小时
						</td>
					</tr>
					<tr>
						<td class="field">
							恢复巷道
						</td>
						<td>
							<input value="<%= restoreRoadwayTime%>" type="text" style="width: 80%;" name="restoreRoadwayTime">&nbsp;米
						</td>
						<td class="field">
							挽回经济损失
						</td>
						<td>
							<input value="<%= saveMoney%>" type="text" style="width: 80%;" name="saveMoney">&nbsp;万元
						</td>
						<td class="field">
							其它内容
						</td>
						<td>
							<input value="<%=otherContent %>" type="text" style="width: 100%;" name="otherContent">
						</td>
					</tr>
					<tr>
						<td class="field">
							运出尸体
						</td>
						<td>
							<input value="<%=outDeadbodyNum %>" type="text" style="width: 80%;" name="outDeadbodyNum">&nbsp;具
						</td>
						<td class="field">
							姓名
						</td>
						<td colspan="3">
							<input value="<%=diePersonNames %>" type="text" style="width: 100%;" name="diePersonNames">
						</td>
					</tr>
					<tr>
						<td class="field">
							救出受伤
						</td>
						<td>
							<input value="<%=injuredPersonNum %>" type="text" style="width: 80%;" name="injuredPersonNum">&nbsp;人
						</td>
						<td class="field">
							姓名
						</td>
						<td colspan="3">
							<input value="<%=injuredPersonNames %>" type="text" style="width: 100%;" name="injuredPersonNames">
						</td>
					</tr>
					<tr>
						<td class="field">
							填表人
						</td>
						<td colspan="5">
							<span class="treeSpan" style="width: 335px;" onclick="showTree(this, '<%=request.getContextPath() %>/infomanage/common/personTree.jsp');" treeSelect="true" treeType="1">
								<input name="inputerName" nodeId="" id="deptTreeInput" value="<%=inputerName %>" 
									style="width: 318px;" readonly="readonly" 
									treeSelect="true"><input name="inputerId" value="<%=inputerId %>" type="hidden">
							</span>
						</td>
					</tr>
				</table>
				</div>
			</td>
		</tr>
		<tr>
			<td colspan="2" class="tableBtn">
				<span onclick="doSubmit();">确定</span>
				<span onclick="window.close();">取消</span>
			</td>
		</tr>
		<tr valign="top">
			<td colspan="2">
				&nbsp;
			</td>
		</tr>
	</table>
	</form>
	<iframe src="#" frameborder="0" id="treeFrame" name="frame" style="display: none;position: absolute;"></iframe>
	<iframe src="#" name="actionFrame" style="display: none;"></iframe>
</body>
</html>